<?php

namespace App\Jobs;

use App\Models\Notice;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\DB;

class ProcessPodcast implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct()
    {
//        $this->notice = $notice;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
//        DB::beginTransaction();

        Notice::create([
             'id'=>899,
             'title'=>99,
             'content'=>'ProcessPodcast',
             'is_popup'=>true
        ]);
        return true;
    }

    public function failed(\Exception $exception)
    {
//        Notice::create([
//            'id'=>201,
//            'title'=>99,
//            'content'=>'ProcessPodcast',
//            'is_popup'=>true
//        ]);
        \Log::error('XXXXXXXXXXXXXXXXXXXX', ['error' => $exception->getMessage()]);
//
    }
}
